import request from "@/utils/request_oil";
import { data } from "jquery";
import { method } from "lodash";

// 查询非油分类树
export function getNonOilCategoryTreeApi(query = {}) {
  return request({
    url: "/nonOilCategory/getNonOilCategoryTree",
    method: "post",
    data: query,
  });
}

// 添加分类
export function AddNonOilCategoryApi(nonOilCategory) {
  return request({
    url: "/nonOilCategory/insert",
    method: "post",
    data: nonOilCategory,
  });
}

// 修改分类
export function updateNonOilCategoryApi(nonOilCategory) {
  return request({
    url: "/nonOilCategory/update",
    method: "post",
    data: nonOilCategory,
  });
}

// 批量删除分类
export function deleteNonOilCategoryApi(categoryIds) {
  return request({
    url: "/nonOilCategory/delete",
    method: "post",
    data: categoryIds,
  });
}

// POST /nonOil/list 查看班结列表
export function nonOilList(categoryIds) {
  return request({
    url: "/nonOil/list",
    method: "post",
    data: categoryIds,
  });
}

// get 查看班结列表详情 classSettlement/details
export function classSettlementDetails(query) {
  return request({
    url: "/nonOil/details",
    method: "get",
    params: query,
  });
}

// GET /supplier/allList 查询所有供应商
export function supplierAllList(query) {
  return request({
    url: "/supplier/allList",
    method: "get",
    params: query,
  });
}

// POST /supplier/list 查询供应商列表
export function supplierList(categoryIds) {
  return request({
    url: "/supplier/list",
    method: "post",
    data: categoryIds,
  });
}

// POST /supplier/add 新增供应商
export function supplierAdd(categoryIds) {
  return request({
    url: "/supplier/add",
    method: "post",
    data: categoryIds,
  });
}

// POST /supplier/update 修改供应商信息
export function supplierUpdate(categoryIds) {
  return request({
    url: "/supplier/update",
    method: "post",
    data: categoryIds,
  });
}

// GET /supplier/delete 删除供应商
export function supplierDelete(query) {
  return request({
    url: "/supplier/delete",
    method: "get",
    params: query,
  });
}

// POST /supplier/export 导出供应商列表
export function supplierExport(categoryIds) {
  return request({
    url: "/supplier/export",
    method: "post",
    data: categoryIds,
  });
}

// POST /repository/list 查询仓库列表
export function repositoryList(categoryIds) {
  return request({
    url: "/repository/list",
    method: "post",
    data: categoryIds,
  });
}

// POST /repository/add 新增仓库
export function repositoryAdd(categoryIds) {
  return request({
    url: "/repository/add",
    method: "post",
    data: categoryIds,
  });
}

// POST /repository/export 查询仓库列表
export function repositoryExport(categoryIds) {
  return request({
    url: "/repository/export",
    method: "post",
    data: categoryIds,
  });
}

// GET /repository/delete 删除仓库
export function repositoryEelete(query) {
  return request({
    url: "/repository/delete",
    method: "get",
    params: query,
  });
}

// POST /repository/update 修改仓库
export function repositoryUpdate(categoryIds) {
  return request({
    url: "/repository/update",
    method: "post",
    data: categoryIds,
  });
}

// 调拨出库
// POST / outboundRecords / addOutboundOrder / add 新增调拨出库商品信息
export function addOutboundOrderAdd(categoryIds) {
  return request({
    url: "/outboundRecords/addOutboundOrder/add",
    method: "post",
    data: categoryIds,
  });
}

// POST /outboundRecords/selectOutboundList/list 查询商品出库列表
export function selectOutboundListList(categoryIds) {
  return request({
    url: "/outboundRecords/selectOutboundList/list",
    method: "post",
    data: categoryIds,
  });
}

// GET /outboundRecords/selectOutboundOrderDetail/{outboundRecordsId} 查询商品调拨出库详情
export function selectOutboundOrderDetail(outboundRecordsId) {
  console.log(outboundRecordsId);
  return request({
    url: `/outboundRecords/selectOutboundOrderDetail/${outboundRecordsId}`,
    method: "get",
  });
}

// 调拨入库
// POST /storageRecords/selectStorageRecordsList/list ;查询商品入库列表;
export function selectStorageRecordsList(categoryIds) {
  return request({
    url: "/storageRecords/selectStorageRecordsList/list",
    method: "post",
    data: categoryIds,
  });
}

// POST /storageRecords/updateStorageRecords/update 修改调拨入库数量
export function updateStorageRecordsUpdate(categoryIds) {
  return request({
    url: "/storageRecords/updateStorageRecords/update",
    method: "post",
    data: categoryIds,
  });
}

// POST /storageRecords/confirmStorage/confirm 确认入库;
export function confirmStorageConfirm(categoryIds) {
  return request({
    url: "/storageRecords/confirmStorage/confirm",
    method: "post",
    data: categoryIds,
  });
}

// GET /storageRecords/selectStorageRecordsDetails/{storageDetailsId} 查询商品调拨入库详情
export function selectStorageRecordsDetails(outboundRecordsId) {
  return request({
    url: `/storageRecords/selectStorageRecordsDetails/${outboundRecordsId}`,
    method: "get",
  });
}
export function getRepositoryApi() {
  return request({
    url: `/station/message/getRepository`,
    method: "get",
  });
}